// pages/home/home.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
    duration: 500,

    banner_array: [{
        id: 3,
        name: "王羲之故居",
        desc: "古典园林式建筑，为全国重点文物保护单位--兰山区",
        imgUrl: "https://bkimg.cdn.bcebos.com/pic/b64543a98226cffcaf71c89eb4014a90f603ea47?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxMTY=,xp_5,yp_5",
        extras: "备注",
      },
      {
        id: 4,
        name: "临沂动植物园",
        desc: "鲁南苏北地区唯一大型综合生态旅游目的地--河东区",
        imgUrl: "https://bkimg.cdn.bcebos.com/pic/342ac65c103853431bc1cbdd9a13b07ecb8088c4?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UyMjA=,xp_5,yp_5",
        extras: "备注",
      },

      {
        id: 7,
        name: "华东革命烈士陵园",
        desc: "国务院第一批“全国重点烈士纪念建筑物保护单位”--兰山区",
        imgUrl: "https://bkimg.cdn.bcebos.com/pic/0bd162d9f2d3572c8f10d5998713632763d0c381?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxODA=,xp_5,yp_5",
        extras: "备注",
      },

      {
        id: 11,
        name: "皇山东夷文化公园",
        desc: "以东夷文化为纽带，再现历史人文景观，全方位演绎东夷神话故事--河东区",
        imgUrl: "https://bkimg.cdn.bcebos.com/pic/7acb0a46f21fbe0933781d9a69600c338744ad1e?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5",
        extras: "备注",
      },
    ],

    menuitem1: [{
        src: "/assets/ic_home_menu_1.png",
        title: "新房"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "二手房"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "租房"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "团购看房"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "地图找房"
      },

    ],
    menuitem2: [{
        src: "/assets/ic_home_menu_1.png",
        title: "资讯"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "楼市圈"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "置业顾问"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "经纪人"
      },
      {
        src: "/assets/ic_home_menu_1.png",
        title: "预售查询"
      },

    ],

    // 热门楼盘数据
    building_list_hot: [{
        name: "领秀城",
        price: "12000",
        state: "在售",
        src: "https://img1.baidu.com/it/u=2026414630,969097521&fm=11&fmt=auto&gp=0.jpg",
      },
      {
        name: "时代新城",
        price: "15000",
        state: "预售",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg8.jiwu.com%2Fnewbuildpic%2F22%2F2%2F17678%2F17678548_s.jpg&refer=http%3A%2F%2Fimg8.jiwu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622219641&t=4469578d3512d3401466898edb88b018",
      },
      {
        name: "中央经典城",
        price: "11000",
        state: "售罄",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.zfimg.com%2F2020-09-20%2Fdce9c74a6ee3ad3ca5f07f49500b5929.jpg%40%21240x150&refer=http%3A%2F%2Fpic1.zfimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622219641&t=4081c6d3e84be4e7c86da937ae702d43",
      },
      {
        name: "翡翠郡",
        price: "18000",
        state: "在售",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.zfimg.com%2F2021-03-29%2F2ec79e13fd28737e347ecbc0ee2278c2.jpg%40%21240x150&refer=http%3A%2F%2Fpic1.zfimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622219641&t=7e0b81af93223abb248318fc457b75bc",
      },
      {
        name: "纽伦港小镇",
        price: "9000",
        state: "清盘",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.zfimg.com%2F2020-01-18%2Faeaba18de338cd4c2455d4bd354b859b.jpg%40%21240x150&refer=http%3A%2F%2Fpic1.zfimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622219641&t=7f817174458633d67ae18892a638cca6",
      },
      {
        name: "沂城之门CBD",
        price: "18800",
        state: "预售",
        src: "  https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.zfimg.com%2F2020-09-19%2F2dd5822f9d124b441a098692acc20a3e.jpg%40%21240x150&refer=http%3A%2F%2Fpic1.zfimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622223812&t=4e73bb083b83f516f1cb35ac260e729e",
      },

    ],

    // 二手房数据
    old_house_list: [{
        room: "智慧公寓1室1厅1卫",
        type: "1室1厅1卫",
        area: "50",
        community: "领秀城",
        price: "12000",
        total: "60万",
        state: "在售",
        src: "https://img2.baidu.com/it/u=209206436,296779899&fm=11&fmt=auto&gp=0.jpg",
      },
      {
        room: "花园洋房3室2厅1卫",
        type: "3室2厅1卫",
        area: "144",
        community: "时代新城",
        price: "15000",
        total: "220万",
        state: "预售",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.ajkimg.com%2Fdisplay%2Fhj%2Fa97a688e074135dba677c1aa41c22133%2F150x115c.jpg%3Ft%3D1&refer=http%3A%2F%2Fpic1.ajkimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622297520&t=b99cf2cf9d22f805c13e64685eac8607",
      },
      {
        community: "中央经典城",
        room: "小高层2室2厅1卫",
        type: "2室2厅1卫",
        area: "98",
        price: "11000",
        total: "108万",
        state: "售罄",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.myfun7.com%2Foss%2Fonline%2FsearchPhotoSale%2F2019%2F08%2F24%2F22935bb11ebc412f97c4dc46e467879a.jpg%3Fx-oss-process%3Dimage%2Fresize%2Cm_fill%2Ch_180%2Cw_135&refer=http%3A%2F%2Fpic.myfun7.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622297520&t=c5d0cd26d92669a50530b4598ef13a6b",
      },
      {
        room: "经典别墅4室2厅2卫",
        type: "4室2厅2卫",
        area: "165",
        community: "翡翠郡",
        price: "18000",
        total: "290万",
        total: "",
        state: "在售",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.ajkimg.com%2Fdisplay%2Fhj%2F8178fe82b21e13fde8055f8d4258c8c2%2F150x115c.jpg%3Ft%3D1&refer=http%3A%2F%2Fpic1.ajkimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622297520&t=22b898de6d3ce6fde12e9a623151a5a4",
      },
      {
        room: "花园洋房3室2厅1卫",
        type: "3室2厅1卫",
        area: "144",
        community: "纽伦港小镇",
        price: "9000",
        total: "130万",
        state: "清盘",
        src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.ajkimg.com%2Fdisplay%2Fhj%2F053f9d5075fce18fba9473cd524ce177%2F150x115c.jpg%3Ft%3D1&refer=http%3A%2F%2Fpic1.ajkimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622297606&t=21a2dbb6c5a678d8370c544571f08519",
      },
      {
        room: "5A级写字楼1室",
        type: "1室1厅",
        area: "200",
        community: "沂城之门CBD",
        price: "18800",
        total: "366万",
        state: "预售",
        src: "https://img2.baidu.com/it/u=2974258492,3605019911&fm=11&fmt=auto&gp=0.jpg",
      },

    ]


  },

  onMenu1Click: function (event) {
    var index = event.currentTarget.dataset.index;
    if (index === 0) { // 新房
      wx.navigateTo({
        url: '/pages/inner1/newhouse/newhouse',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 1) { // 二手房
      wx.navigateTo({
        url: '/pages/inner1/oldhouse/oldhouse',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 2) { // 租房
      wx.navigateTo({
        url: '/pages/renthouse/renthouse',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 3) { // 团购看房
      wx.navigateTo({
        url: '/pages/group_buy/group_buy',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 4) { // 地图找房
      wx.navigateTo({
        url: '/pages/map_house/map_house',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else {
      wx.showToast({
        title: this.data.menuitem1[index].title,
      })
    }
  },

  onMenu2Click: function (event) {
    var index = event.currentTarget.dataset.index;
    if (index === 0) { // 资讯
      wx.navigateTo({
        url: '/pages/news/news',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 1) { // 楼市圈
      wx.navigateTo({
        url: '/pages/inner1/oldhouse/oldhouse',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 2) { // 置业顾问
      wx.navigateTo({
        url: '/pages/renthouse/renthouse',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 3) { // 经纪人
      wx.navigateTo({
        url: '/pages/group_buy/group_buy',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else if (index === 4) { // 预售查询
      wx.navigateTo({
        url: '/pages/map_house/map_house',
        success: function (res) {
          console.log(res);
        },
        fail: function (res) {
          console.log(res);
        }
      })
    } else {
      wx.showToast({
        title: this.data.menuitem1[index].title,
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})